package com.cncf.controller.user;

import com.cncf.entity.SecondReportView;
import com.cncf.response.ResponseData;
import com.cncf.service.SecondReportViewService;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zj
 */
@Api(value = "User", description = "查询检验报告")
@Controller
@RequestMapping("/user/secondReportView")
public class UserSecondReportViewController {
    @Autowired
    private SecondReportViewService secondReportViewService;

    @ApiOperation(value = "通过id获取报告信息", notes = "")
    @RequestMapping(value = "selectById/{id}", method = {RequestMethod.GET})
    @ResponseBody
    public ResponseData<SecondReportView> selectById(@ApiParam("报告id") @PathVariable String id){
        return secondReportViewService.selectById(id);
    }

    @ApiOperation(value = "通过生产单位获取报告信息", notes = "")
    @RequestMapping(value = "selectByProductUnit/{productUnit}", method = {RequestMethod.GET})
    @ResponseBody
    public ResponseData<List<SecondReportView>> selectByProductUnit(@ApiParam("生产单位") @PathVariable String productUnit){
        return secondReportViewService.selectByProductUnit(productUnit);
    }

}
